import datetime

from django.db import models

class Current(models.Model):
    name = models.CharField(verbose_name="用户名", max_length=18)
    phone = models.CharField(verbose_name="电话账号", max_length=18)
    email = models.CharField(verbose_name="邮箱", max_length=18)
    password = models.IntegerField(verbose_name="密码")

    class Meta:
        db_table = 'current'

    def __str__(self):
        return self.name

class PersonalInformation(models.Model):
    user = models.OneToOneField(Current, on_delete=models.CASCADE, related_name='personal_info')
    name = models.CharField(verbose_name="姓名", max_length=18)
    sex = models.CharField(choices=[(0, "男"), (1, '女')], default=0, max_length=200)
    age = models.CharField(verbose_name="年龄", max_length=4)
    state_choices = [
        (0, "沟通过"),
        (1, "已投递"),
        (2, "待面试"),
    ]
    state = models.CharField(choices=state_choices, default=1, max_length=200)
    choices = [
        (0, "月内到岗"),
        (1, "考虑机会"),
        (2, "暂不考虑"),
        (3, "随时离岗"),
    ]
    On_duty_time = models.CharField(choices=choices, default=1, max_length=200)

    class Meta:
        db_table = 'Personal_Information'

    def __str__(self):
        return self.name

''' 优势亮点'''
class Advantages(models.Model):
    Advantages = models.CharField(verbose_name="优势亮点", max_length=200)
    personal = models.ForeignKey(PersonalInformation, on_delete=models.CASCADE)
    class Meta:
        db_table = 'Advantages'
    def __str__(self):
        return self.name
''' 期望职业 '''
class Expected(models.Model):
    work = models.CharField(verbose_name="职业" , max_length=20)
    salary = models.IntegerField(verbose_name="薪资")
    location = models.CharField(verbose_name="工作地点", max_length=200)
    personal = models.ForeignKey(PersonalInformation, on_delete=models.CASCADE)
    class Meta:
        db_table = 'Expected'
    def __str__(self):
        return self.name
'''工作经历'''
class Work_Experience(models.Model):
    unit = models.CharField(verbose_name="工作单位",max_length=25)
    datetime = models.CharField(verbose_name="工作时间", max_length=50)
    duties = models.CharField(verbose_name="职务", max_length=20)
    personal = models.ForeignKey(PersonalInformation, on_delete=models.CASCADE)
    class Meta:
        db_table = 'Work_Experience'
    def __str__(self):
        return self.name
'''教育经历'''
class Educational_experience(models.Model):
    school = models.CharField(verbose_name="学校", max_length=25)
    time = models.CharField(verbose_name="受教育时间", max_length=50)
    education = models.CharField(verbose_name="学历", max_length=20)
    speciality = models.CharField(verbose_name="专业", max_length=50)
    personal = models.ForeignKey(PersonalInformation, on_delete=models.CASCADE)
    class Meta:
        db_table = 'Educational_experience'
    def __str__(self):
        return self.name
'''技能特长'''
class Skills(models.Model):
    skill = models.CharField(verbose_name="技能特长", max_length=200)
    lectureTeacher = models.ForeignKey(PersonalInformation, on_delete=models.CASCADE)
    class Meta:
        db_table = 'Skills'
    def __str__(self):
        return self.name
'''语言能力'''
class Language_ability(models.Model):
    language = models.CharField(verbose_name="语言特长", max_length=200)
    personal = models.ForeignKey(PersonalInformation, on_delete=models.CASCADE)
    class Meta:
        db_table = 'Language_ability'
    def __str__(self):
        return self.name
'''其他'''
class Others(models.Model):
    other = models.CharField(verbose_name="其他", max_length=200)
    personal = models.ForeignKey(PersonalInformation, on_delete=models.CASCADE)
    class Meta:
        db_table = 'Others'
    def __str__(self):
        return self.name


